/**
 * @file ArmorTrackerBase.h
 * @brief
 * @author LiuZhihao (2488288779@qq.com)
 * @date 2023-12-10
 *
 * @copyright Copyright (C) 2023, HITCRT_VISION, all rights reserved.
 *
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Author  <th>Description
 * <tr><td>2023-12-10 <td>LiuZhihao  <td>
 * </table>
 */
#pragma once

#include <chrono>
#include <fstream>

#include "ArmorBase.h"
#include "../basic/Basic.h"
#include "TrackBase.h"
namespace hitcrt {

// 原轨迹匹配的匹配部分拆出
// 原轨迹匹配的决策部分拿到其他地方
class ArmorTrackerBase {
   public:
    ArmorTrackerBase(const uint maxTrackSize, const uint maxArmorSize,
                     std::vector<std::shared_ptr<Track>> &tracks);
    virtual void apply(const TimePoint detectTime, std::vector<Armor> &armors);
    // std::vector<Track> m_tracks;
    std::vector<std::shared_ptr<Track>> &m_tracks;

   protected:
    virtual int createTracks(Armor _armor, const TimePoint detectTime);
    virtual std::map<uint, uint> associate(std::vector<Armor> &armors);
    virtual void update(std::map<uint, uint> &matchResult, const std::vector<Armor> &armors);
    virtual int matchImpl(std::shared_ptr<Track> &trj, std::vector<Armor> &armors);
    void setDetectTime(const TimePoint detectTime);
    void kalmanFilter();
    std::vector<int> m_armorIsUsed;  //装甲板是否匹配轨迹的标志
    TimePoint m_detectTime;
    const uint m_maxTrackSize;
    const uint m_maxArmorSize;
};
}  // namespace hitcrt
